#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main()
{
	int i = 0;
	for (i = 1; i <= 100000; i++)
	{
		int count = 0;
		int tmp = 0;
		tmp = i;
		while (tmp)
		{
			tmp /= 10;
			count++;
		}
		tmp = i;
		int sum = 0;
		while (tmp)
		{
			sum = sum + pow(tmp % 10, count);
			tmp /= 10;
		}
		if (i == sum)
		{
			printf("%d ", i);
		}
	}
	return 0;
}
